import openpyxl
import pymysql
import yaml


def read_excel_data(file_path, sheet_name):
    wb = openpyxl.load_workbook(file_path)
    ws = wb[sheet_name]
    data = []
    for row in ws.iter_rows(min_row=1, values_only=True):
        data.append(row)
    return data                                                #读取excel


test_data = read_excel_data('qccsj.xlsx', 'test_data')
test_data_for_login = [(username, password, expected_title) for username, password, expected_title, _ in test_data]
zc_data = read_excel_data('qccsj.xlsx', 'zc-data')
xzyhk_data = read_excel_data('qccsj.xlsx', 'xzyhk_data')
scyhk_data = read_excel_data('qccsj.xlsx', 'scyhk_data')
wangdai_data = read_excel_data('qccsj.xlsx', 'wangdai_data')        #excel


'''
def read_mysql(host='localhost', port=3306, user='root', password='root', db='test', charset='utf8', element='*', table=None, condition=None):
    con = pymysql.connect(host=host, port=port, user=user, password=password, db=db, charset=charset)
    cur = con.cursor()
    sql = f'select {element} from {table} where {condition}'
    cur.execute(sql)
    data = cur.fetchall()
    cur.close()
    con.close()
    return data                    #数据库
'''

'''
def read_yaml_data(file_path):
    with open(file_path, 'r') as file:
        data = yaml.safe_load(file)
    return data                      #yaml
'''












